structure WindowsPath = WindowsPath (OS.Path);
fun printString s = print ("\"" ^ String.toString s ^ "\"\n")
fun printPath { isAbs, vol, arcs } = print ("{ isAbs = " ^ Bool.toString isAbs ^ ", vol = \"" ^ String.toString vol ^ "\", arcs = [" ^ String.concatWith "," (List.map (fn s => "\"" ^ String.toString s ^ "\"") arcs) ^ "] }\n");
printPath (WindowsPath.fromString "");
printPath (WindowsPath.fromString "/");
printPath (WindowsPath.fromString "//");
printPath (WindowsPath.fromString "a");
printPath (WindowsPath.fromString "/a");
printPath (WindowsPath.fromString "//a");
printPath (WindowsPath.fromString "a/");
printPath (WindowsPath.fromString "a//");
printPath (WindowsPath.fromString "a/b");
printPath (WindowsPath.fromString "C:\\Users\\a/b");
printPath (WindowsPath.fromString "z:a/b");
printPath (WindowsPath.fromString "\\\\server\\share");
printPath (WindowsPath.fromString "//server/share/foo/bar.txt");
printPath (WindowsPath.fromString "\\/server\\share\\");
printPath (WindowsPath.fromString "/\\server/share\\foo\\bar.txt");
printString (WindowsPath.toString { isAbs = false, vol = "", arcs = [] });
fun printDirFile { dir, file } = print ("{ dir = \"" ^ String.toString dir ^ "\", file = \"" ^ String.toString file ^ "\" }\n");
printDirFile (WindowsPath.splitDirFile "");
printDirFile (WindowsPath.splitDirFile ".");
printDirFile (WindowsPath.splitDirFile "b");
printDirFile (WindowsPath.splitDirFile "b/");
printDirFile (WindowsPath.splitDirFile "a/b");
(* printDirFile (WindowsPath.splitDirFile "/a"); *)
fun printBaseExt { base, ext = NONE } = print ("{ base = \"" ^ String.toString base ^ "\", ext = NONE }\n")
  | printBaseExt { base, ext = SOME ext } = print ("{ base = \"" ^ String.toString base ^ "\", ext = SOME \"" ^ String.toString ext ^ "\" }\n");
printBaseExt (WindowsPath.splitBaseExt "");
printBaseExt (WindowsPath.splitBaseExt ".login");
(* printBaseExt (WindowsPath.splitBaseExt "/.login"); *)
printBaseExt (WindowsPath.splitBaseExt "a");
printBaseExt (WindowsPath.splitBaseExt "a.");
printBaseExt (WindowsPath.splitBaseExt "a.b");
printBaseExt (WindowsPath.splitBaseExt "a.b.c");
printBaseExt (WindowsPath.splitBaseExt ".news/comp");
printString (WindowsPath.mkRelative { path = "a/b", relativeTo = "z:/c/d" });
printString (WindowsPath.mkRelative { path = "z:a/b", relativeTo = "z:/c/d" });
printString (WindowsPath.mkRelative { path = "u:/", relativeTo = "u:/a/b/c" });
printString (WindowsPath.mkRelative { path = "b:/a/b/", relativeTo = "B:/a/c" });
printString (WindowsPath.mkRelative { path = "D:/a/b", relativeTo = "d:/a/c" });
printString (WindowsPath.mkRelative { path = "u:/a/b/", relativeTo = "u:/a/c/" });
printString (WindowsPath.mkRelative { path = "z:/a/b", relativeTo = "z:/a/c/" });
printString (WindowsPath.mkRelative { path = "x:/", relativeTo = "x:/" });
printString (WindowsPath.mkRelative { path = "C:/", relativeTo = "c:/." });
printString (WindowsPath.mkRelative { path = "u:/", relativeTo = "u:/.." });
printString (WindowsPath.mkRelative { path = "S:/a/b/../c", relativeTo = "s:/a/d" });
printString (WindowsPath.mkRelative { path = "K:/a/b", relativeTo = "k:/c/d" });
printString (WindowsPath.mkRelative { path = "T:/c/a/b", relativeTo = "T:/c/d" });
printString (WindowsPath.mkRelative { path = "s:/c/d/a/b", relativeTo = "S:/c/d" });
printString (WindowsPath.mkRelative { path = "\\\\server\\share\\a\\b", relativeTo = "\\\\server\\share\\foo" });
printString (WindowsPath.getParent "/");
printString (WindowsPath.getParent "a");
printString (WindowsPath.getParent "a/");
printString (WindowsPath.getParent "a///");
printString (WindowsPath.getParent "a/b");
printString (WindowsPath.getParent "a/b/");
printString (WindowsPath.getParent "..");
printString (WindowsPath.getParent ".");
printString (WindowsPath.getParent "");
printString (WindowsPath.getParent "///");
print (Bool.toString (WindowsPath.validVolume { isAbs = false, vol = "C:" }) ^ "\n");
print (Bool.toString (WindowsPath.validVolume { isAbs = true, vol = "d:" }) ^ "\n");
print (Bool.toString (WindowsPath.validVolume { isAbs = false, vol = "" }) ^ "\n");
print (Bool.toString (WindowsPath.validVolume { isAbs = true, vol = "" }) ^ "\n");
print (Bool.toString (WindowsPath.validVolume { isAbs = false, vol = "\\\\server\\share" }) ^ "\n");
print (Bool.toString (WindowsPath.validVolume { isAbs = true, vol = "\\\\server\\share" }) ^ "\n");
print (Bool.toString (WindowsPath.validVolume { isAbs = true, vol = "//server/share" }) ^ "\n");
print (Bool.toString (WindowsPath.validVolume { isAbs = true, vol = "//server/share/" }) ^ "\n");
printString (WindowsPath.getVolume "");
printString (WindowsPath.getVolume "z:\\foo");
printString (WindowsPath.getVolume "A:someDir");
printString (WindowsPath.getVolume "U:");
printString (WindowsPath.getVolume "//server/share/foo/bar/baz");
printString (WindowsPath.getVolume "\\\\server\\share\\a\\b\\c");
